<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <script>

        // 作用，改变this指向
        // 区别，后面传的参数形式不同

        function Person(name, age) {
            this.name = name; 
            this.age = age;
        }

        var person = new Person('deng', 35);

        var obj = {};

        Person.call(obj, 'bai', 27); //Person里面所有this指向obj
        // 第一位会改变this指向，后面两位当做正常实参
        // 借助Person来实现为obj增加属性





        // function test() {

        // }
        // test();  // test()就相当于test.call()，隐式执行
    </script> -->

    <script>

        function Person(name, age, sex) {
            this.name = name;
            this.age = age;
            this.sex = sex;
        }

        function Student(name, age, sex, tel, grade) {
            // this.name = name;
            // this.age = age;
            // this.sex = sex;
            Person.call(this, name, age, sex);
            // this也被传进Person里面了，所以作用域可以访问的到
            this.tel = tel;
            this.grade = grade;
        }


        var student = new Student('sunny', 17, 'female', 178, 2017);



        ////////////////////

        function Wheel(size, style) {
            this.style = style;
            this.size = size;
        }

        function Sit(c, sitColor) {
            this.c = c;
            this.sitColor = sitColor;
        }

        function Model(height, width, len) {
            this.height = height;
            this.width = width;
            this.len = len;
        }
        function Car(size, style, c, sitColor, height, width, len) {
            Wheel.call(this, size, style);
            Sit.call(this, c, sitColor);

            Model.apply(this, [height, width, len]);

        }
        var car = new Car(100, '花里胡哨', '真皮','red', 1800, 1900, 4900);
    </script>
</body>
</html>